Conversation
| for (int i = 0; i < unsort.size(); ++i) { | ||
| std ::cout << unsort[i] << " "; | ||
| } | ||
| std ::cout << std ::endl; |
There was a problem hiding this comment.
warning: do not use 'std ::endl' with streams; use '\n' instead [performance-avoid-endl]
| std ::cout << std ::endl; | |
| std ::cout << '\n'; |
| #include <vector> | ||
|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { |
There was a problem hiding this comment.
warning: 'T' does not refer to a value [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^Additional context
task_02/src/stack.hpp:5: declared here
template <typename T>
^|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { | ||
| { a < b } -> std::convertible_to<bool>; |
There was a problem hiding this comment.
warning: 'T' does not refer to a value [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^Additional context
task_02/src/stack.hpp:5: declared here
template <typename T>
^|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { | ||
| { a < b } -> std::convertible_to<bool>; |
There was a problem hiding this comment.
warning: unknown type name 'concept' [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^| }; | ||
|
|
||
| template <Comparable T> | ||
| class Stack { |
There was a problem hiding this comment.
warning: unknown type name 'Comparable' [clang-diagnostic-error]
template <Comparable T>
^| void Push(int value); | ||
| int Pop(); | ||
| void Push(T k); | ||
| T Pop(); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
void Push(T k);
^| T Stack<T>::Pop() { | ||
| if (_data.size() == 0) throw std::runtime_error("No data in stack"); | ||
| T pop_val{_data.back()}; | ||
| _data.pop_back(); |
There was a problem hiding this comment.
warning: expected ';' after expression [clang-diagnostic-error]
| T pop_val{_data.back()}; | |
| T; pop_val{_data.back()}; |
| T Stack<T>::Pop() { | ||
| if (_data.size() == 0) throw std::runtime_error("No data in stack"); | ||
| T pop_val{_data.back()}; | ||
| _data.pop_back(); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'pop_val' [clang-diagnostic-error]
T pop_val{_data.back()};
^| T pop_val{_data.back()}; | ||
| _data.pop_back(); | ||
| return pop_val; | ||
| } |
There was a problem hiding this comment.
warning: use of undeclared identifier 'pop_val' [clang-diagnostic-error]
return pop_val;
^| } | ||
|
|
||
| template <Comparable T> | ||
| class MinStack { |
There was a problem hiding this comment.
warning: unknown type name 'Comparable' [clang-diagnostic-error]
template <Comparable T>
^|
|
||
| int main() { return 0; } | ||
| void MergeSort(std ::vector<int>& array) { | ||
| int i{0}, j{1}; |
There was a problem hiding this comment.
давай сделаем 1 строка одно объявление
| @@ -0,0 +1,20 @@ | |||
| #include "find.hpp" | |||
|
|
|||
| std ::vector<int> find_nums(int k, std ::vector<int> sequence) { | |||
There was a problem hiding this comment.
FindNums хотя бы, или вообще лучше назвать как-то более понятно. какие числа мы находим, из названия не понятно.
возвращаем вектор из этого не понятно может мы возвращаем 3 числа, или 0, или просто измененный вектор
int k - тоже непонятное имя аргумента
const std ::vector& sequence - не нужно лишнее копирование
| std ::vector<int> find_nums(int k, std ::vector<int> sequence) { | ||
| if (sequence.size() == 0) throw no_sum_num{}; | ||
|
|
||
| std ::vector<int> ans; |
There was a problem hiding this comment.
answer, жалеко символов?) писать сложнее не станет, автодополнение работает почти везде)
| #include <string> | ||
| #include <vector> | ||
|
|
||
| struct no_sum_num { |
There was a problem hiding this comment.
лучше наследоваться от std::exception:
| struct no_sum_num { | |
| class NoSumExist : public std::exception { | |
| using std::exception::exception; | |
| }; |
| #include "stack.hpp" | ||
|
|
||
| #include <algorithm> | ||
| // template <typename T> |
There was a problem hiding this comment.
нехорошо что бы в исходном коде был закоментированный код, если только это не пример использования кода
вроде тут ничего нет кода, просто удали файл что бы глаза не мазолил
|
|
||
| #include "warming_func.hpp" | ||
|
|
||
| std ::vector<int> warming(std ::vector<int> temperature) { |
There was a problem hiding this comment.
хотя бы Warming и то не очень понятно что это функция (обычно в имени функции глагол) и не очень понятно что она делает
| int main() { return 0; } | ||
| #include "sorting.hpp" | ||
|
|
||
| // template <typename T> |
There was a problem hiding this comment.
выше писал про закоментированый код
There was a problem hiding this comment.
далее тоже поправь таккие места, не буду писать комментарии об этом
| // return ans; | ||
| // } | ||
|
|
||
| void MergeSort(std ::vector<int>& array) { |
There was a problem hiding this comment.
это не сортировка слиянеием(
поправь потом посмотрю
| void Push(int value); | ||
| int Pop(); | ||
| int GetMin(); | ||
| void Push(T k); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
void Push(T k);
^| int GetMin(); | ||
| void Push(T k); | ||
| T Pop(); | ||
| T GetMin(); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
T Pop();
^| void Push(T k); | ||
| T Pop(); | ||
| T GetMin(); | ||
|
|
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
T GetMin();
^| private: | ||
| std::vector<int> data_; | ||
| std ::vector<T> _data; | ||
| std ::vector<T> _min_data; |
There was a problem hiding this comment.
warning: template argument for template type parameter must be a type [clang-diagnostic-error]
std ::vector<T> _data;
^Additional context
/usr/include/c++/13/bits/stl_vector.h:426: template parameter is declared here
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
^| if (data.size() == 0) throw std::invalid_argument(""); | ||
| if (n > data.size()) throw std::invalid_argument(""); | ||
|
|
||
| MergeSort(data); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'MergeSort' [clang-diagnostic-error]
MergeSort(data);
^| KDTree tree(cloud); | ||
| std ::cout << "compiled\n"; | ||
| Point k = tree.NearestPoint(Point(4.8, 5.9)); | ||
| std ::cout << k.x << " " << k.y << std ::endl; |
There was a problem hiding this comment.
warning: do not use 'std ::endl' with streams; use '\n' instead [performance-avoid-endl]
| std ::cout << k.x << " " << k.y << std ::endl; | |
| std ::cout << k.x << " " << k.y << '\n'; |
|
|
||
| #include "KDtree.hpp" | ||
|
|
||
| std::vector<Point> GenerateRandomPoints(size_t count, double min = 0.0, |
There was a problem hiding this comment.
warning: function 'GenerateRandomPoints' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
| std::vector<Point> GenerateRandomPoints(size_t count, double min = 0.0, | |
| static std::vector<Point> GenerateRandomPoints(size_t count, double min = 0.0, |
| @@ -0,0 +1,55 @@ | |||
| #include <omp.h> | |||
There was a problem hiding this comment.
warning: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>
^| class HashTable { | ||
| public: | ||
| HashTable(); | ||
| HashTable(std ::vector<int> InputData) : data{InputData} {}; |
There was a problem hiding this comment.
warning: parameter 'InputData' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
task_08/src/HashTable.hpp:0:
- #include <vector>
+ #include <utility>
+ #include <vector>| HashTable(std ::vector<int> InputData) : data{InputData} {}; | |
| HashTable(std ::vector<int> InputData) : data{std::move(InputData)} {}; |
| #include <execution> | ||
| #include <stdexcept> | ||
|
|
||
| #include "constants.hpp" |
There was a problem hiding this comment.
уже добавлен в KDtree.hpp тут лучше удалить
| struct Point { | ||
| double x; | ||
| double y; | ||
| Point(double xx, double yy) : x{xx}, y{yy} {} |
There was a problem hiding this comment.
| Point(double xx, double yy) : x{xx}, y{yy} {} | |
| Point(double x, double y) : x{x}, y{y} {} |
| node->right_child->indices.first = node->indices.first + left_count; | ||
| node->right_child->indices.second = node->indices.second; | ||
|
|
||
| Ax == axis::Ox ? Ax = axis::Oy : Ax = axis::Ox; |
There was a problem hiding this comment.
тяжело читается, лучше вот так:
| Ax == axis::Ox ? Ax = axis::Oy : Ax = axis::Ox; | |
| Ax = (Ax == axis::Ox) ? axis::Oy : axis::Ox; |
| } | ||
|
|
||
| KDTree::KDTree(std ::vector<Point> points) { | ||
| if (points.size() == 0) throw std::invalid_argument{"No Points detected"}; |
There was a problem hiding this comment.
| if (points.size() == 0) throw std::invalid_argument{"No Points detected"}; | |
| if (points.empty()) throw std::invalid_argument{"No Points detected"}; |
| // принадлежащих данной bounding_box [от, до] | ||
| }; | ||
| std::unique_ptr<Node> root; | ||
| enum class axis { |
| Oy = 1, | ||
| }; | ||
|
|
||
| void split(std::unique_ptr<Node>& node, axis Ax = axis::Ox, int depth = 0); |
| } | ||
|
|
||
| void KDTree::split(std::unique_ptr<Node>& node, axis Ax, int depth) { | ||
| std ::pair<double, double> SAH = KDTree::SAH( |
There was a problem hiding this comment.
лишний пробел в std ::pair<double, double>
| @@ -0,0 +1,98 @@ | |||
| #include "KDtree.hpp" | |||
|
|
|||
| #include <omp.h> | |||
There was a problem hiding this comment.
warning: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>
^|
|
||
| Ax == axis::Ox ? Ax = axis::Oy : Ax = axis::Ox; | ||
|
|
||
| if (depth < max_parallel_depth) { |
There was a problem hiding this comment.
warning: if with identical then and else branches [bugprone-branch-clone]
if (depth < max_parallel_depth) {
^Additional context
task_07/src/KDtree.cpp:76: else branch starts here
} else {
^|
|
||
| bool operator==(const Point& other) const { | ||
| constexpr double epsilon = 1e-9; | ||
| return (std::abs(x - other.x) < epsilon) && |
There was a problem hiding this comment.
warning: no member named 'abs' in namespace 'std' [clang-diagnostic-error]
return (std::abs(x - other.x) < epsilon) &&
^| bool operator==(const Point& other) const { | ||
| constexpr double epsilon = 1e-9; | ||
| return (std::abs(x - other.x) < epsilon) && | ||
| (std::abs(y - other.y) < epsilon); |
There was a problem hiding this comment.
warning: no member named 'abs' in namespace 'std' [clang-diagnostic-error]
(std::abs(y - other.y) < epsilon);
^| Oy = 1, | ||
| }; | ||
|
|
||
| void split(std::unique_ptr<Node>& node, axis Ax = axis::Ox, int depth = 0); |
There was a problem hiding this comment.
warning: enum 'axis' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]
axis {
^| std::vector<Elem> NewData(data.size() * 2, ZeroElem); | ||
| std::vector<Elem> OldData = std::move(data); | ||
| data = std::move(NewData); | ||
| for (auto elem : OldData) { |
There was a problem hiding this comment.
warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
| for (auto elem : OldData) { | |
| for (const auto& elem : OldData) { |
| } | ||
| } | ||
|
|
||
| void HashTable::add(std::string key, int value) { |
There was a problem hiding this comment.
warning: the parameter 'key' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
task_08/src/HashTable.hpp:7:
- void add(std::string key, int value);
+ void add(const std::string& key, int value);| void HashTable::add(std::string key, int value) { | |
| void HashTable::add(const std::string& key, int value) { |
| if (EngagedSpace > (data.size() / 2)) Resize(); | ||
| } | ||
|
|
||
| void HashTable::remove(std::string key) { |
There was a problem hiding this comment.
warning: the parameter 'key' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
task_08/src/HashTable.hpp:8:
- void remove(std::string key);
+ void remove(const std::string& key);| void HashTable::remove(std::string key) { | |
| void HashTable::remove(const std::string& key) { |
| --EngagedSpace; | ||
| } | ||
|
|
||
| int HashTable::get(std::string key) { |
There was a problem hiding this comment.
warning: the parameter 'key' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
task_08/src/HashTable.hpp:9:
- int get(std::string key);
+ int get(const std::string& key);| int HashTable::get(std::string key) { | |
| int HashTable::get(const std::string& key) { |
| int get(std::string key); | ||
|
|
||
| private: | ||
| enum struct Label { |
There was a problem hiding this comment.
warning: enum 'Label' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]
enum struct Label {
^| #include <vector> | ||
|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { |
There was a problem hiding this comment.
warning: 'T' does not refer to a value [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^Additional context
task_02/src/stack.hpp:4: declared here
template <typename T>
^|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { | ||
| { a < b } -> std::convertible_to<bool>; |
There was a problem hiding this comment.
warning: 'T' does not refer to a value [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^Additional context
task_02/src/stack.hpp:4: declared here
template <typename T>
^|
|
||
| Ax = (Ax == Axis::Ox) ? Axis::Oy : Axis::Ox; | ||
|
|
||
| if (depth < max_parallel_depth) { |
There was a problem hiding this comment.
warning: if with identical then and else branches [bugprone-branch-clone]
if (depth < max_parallel_depth) {
^Additional context
task_07/src/KDtree.cpp:74: else branch starts here
} else {
^| Oy = 1, | ||
| }; | ||
|
|
||
| void Split(std::unique_ptr<Node>& node, Axis Ax = Axis::Ox, int depth = 0); |
There was a problem hiding this comment.
warning: enum 'Axis' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]
Axis {
^| @@ -0,0 +1,45 @@ | |||
| #include "TableTask.hpp" | |||
|
|
|||
| std::vector<std::string> TaskSolve(int n, int m, int k, | |||
There was a problem hiding this comment.
warning: parameter 'k' is unused [misc-unused-parameters]
| std::vector<std::string> TaskSolve(int n, int m, int k, | |
| std::vector<std::string> TaskSolve(int n, int m, int /*k*/, |
| #include <vector> | ||
|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { |
There was a problem hiding this comment.
warning: 'T' does not refer to a value [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^Additional context
task_02/src/stack.hpp:4: declared here
template <typename T>
^| #include <vector> | ||
|
|
||
| template <typename T> | ||
| concept Comparable = requires(T a, T b) { |
There was a problem hiding this comment.
warning: unknown type name 'concept' [clang-diagnostic-error]
concept Comparable = requires(T a, T b) {
^| { a < b } -> std::convertible_to<bool>; | ||
| }; | ||
|
|
||
| template <Comparable T> |
There was a problem hiding this comment.
warning: unknown type name 'Comparable' [clang-diagnostic-error]
template <Comparable T>
^| public: | ||
| void Push(int value); | ||
| int Pop(); | ||
| void Push(T k); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
void Push(T k);
^| void Push(int value); | ||
| int Pop(); | ||
| void Push(T k); | ||
| T Pop(); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
T Pop();
^| template <Comparable T> | ||
| T Stack<T>::Pop() { | ||
| if (_data.size() == 0) throw std::out_of_range("No data in stack"); | ||
| T pop_val{_data.back()}; |
There was a problem hiding this comment.
warning: expected ';' after expression [clang-diagnostic-error]
| T pop_val{_data.back()}; | |
| T; pop_val{_data.back()}; |
| template <Comparable T> | ||
| T Stack<T>::Pop() { | ||
| if (_data.size() == 0) throw std::out_of_range("No data in stack"); | ||
| T pop_val{_data.back()}; |
There was a problem hiding this comment.
warning: use of undeclared identifier 'pop_val' [clang-diagnostic-error]
T pop_val{_data.back()};
^| if (_data.size() == 0) throw std::out_of_range("No data in stack"); | ||
| T pop_val{_data.back()}; | ||
| _data.pop_back(); | ||
| return pop_val; |
There was a problem hiding this comment.
warning: use of undeclared identifier 'pop_val' [clang-diagnostic-error]
return pop_val;
^| return pop_val; | ||
| } | ||
|
|
||
| template <Comparable T> |
There was a problem hiding this comment.
warning: unknown type name 'Comparable' [clang-diagnostic-error]
template <Comparable T>
^| int Pop(); | ||
| int GetMin(); | ||
| void Push(T k); | ||
| T Pop(); |
There was a problem hiding this comment.
warning: unknown type name 'T' [clang-diagnostic-error]
T Pop();
^
KDtree in task 7